import http from '@/utils/request'

// 注册
export const userRegisterService = ({ username, password, repassword }) => {
  return http.post('/api/register', { username, password, repassword })
}

// 登录
export const userLoginService = ({ username, password }) => {
  return http.post('/api/login', { username, password })
}

// 获取用户信息
export const userGetInfoService = () => {
  return http.get('/my/userinfo')
}

// 更新个人信息
export const userUpdateInfoService = ({ id, nickname, email }) => {
  return http.post('/my/userinfo', { id, nickname, email })
}

// 上传图像
export const userUploadAvatarService = (avatar, id) => {
  return http.post('/my/update/avatar', { avatar, id })
}

// 修改密码
export const userUpdatePassService = ({ oldPwd, newPwd }) => {
  return http.post('/my/updatepwd', { oldPwd, newPwd })
}
